﻿using System;
using System.Collections.Generic;
using System.Text;
using Pixysoft.Weblications.Sango.Constant;

namespace Pixysoft.Weblications.Sango.Mission
{
    abstract class MainMissionHandler : IMainMissionHandler
    {
        long serialCode = -1;

        public virtual void initialize(Entities.Mis_Mainmission mission)
        {
            this.serialCode = mission.Serialcode;
        }

        public abstract bool handle(String userCode, Entities.Usr_Mainmission mission);

        public bool meet(Entities.Usr_Mainmission mission)
        {
            // 任务编码，在初始化的时候handler根据数据库配置

            // 玩家的任务编码，在初始化的时候装在到 mainmissionhelper

            if (this.serialCode != mission.Missionserialcode)
                return false;

            if (mission.Missionstatus == GeneralBillStatusCollection.FINISH)
                return false;

            LoggerHelper.Debug("handler meet mission. handler:{0} mission.serialcode:{1}",//
                    this.ToString(), mission.Missionserialcode);

            return true;
        }

    }

}
